raw
<%@ include file="/common/taglibs.jsp"%>
<fmt:message key="headerSelection" scope="request" var="hs" />
<head>
    <title><fmt:message key="materialDetail.title"/></title>
    <meta name="heading" content="<fmt:message key='materialDetail.heading'/>"/>
    <meta name="menu" content="RoleMaterial"/>
    <script type="text/javascript">
        dojo.event.topic.subscribe("/save", function(data, type, request) {
            if(type == "load") {
                dojo.byId("distinctiveIndex").value = "";
                //dojo.byId("distinctiveIndex1").value = "";
                dojo.byId("distinctiveId").value = "";
                //dojo.byId("distinctiveName").value = "";
                // dojo.byId("distinctiveValue").value = "";

                //document.getElementById('deleteDistinctiveForm').style.display = 'none';
            }
        });
        function editDistinctive(row){
            System.out.print("editing distinctive...");
            dojo.byId("distinctiveIndex").value = row.rowIndex - 1;
            //dojo.byId("distinctiveIndex1").value = row.rowIndex - 1;

            var tds = row.getElementsByTagName("td");

            dojo.byId("distinctiveId").value = dojo.string.trim(dojo.dom.textContent(tds[0]));
            dojo.byId("distinctiveName").value = dojo.string.trim(dojo.dom.textContent(tds[1]));
            dojo.byId("distinctiveValue").value = dojo.string.trim(dojo.dom.textContent(tds[2]));

            //document.getElementById('deleteDistinctiveForm').style.display = 'inline';

            $('addDistinctiveButton').fade();
            Effect.SlideDown('divDistinctiveForm');
            return false;
        }
        function retrieveURL(url)
        {
            if (window.XMLHttpRequest)
            {
                // Non-IE browsers
                req = new XMLHttpRequest();
                req.onreadystatechange = processStateChange;
                try {
                    req.open("GET", url, true);
                } catch (e) {
                    alert(e);
                }
                req.send(null);
            } else if (window.ActiveXObject) { // IE
                req = new ActiveXObject("Microsoft.XMLHTTP");
                if (req) {
                    req.onreadystatechange =
                        processStateChange;
                    req.open("GET", url, true);
                    req.send();
                }
            }
        }

        function processStateChange() {
            if (req.readyState == 4) { // Complete
                if (req.status == 200) { // OK response
                    document.getElementById("distinctivesValues").innerHTML = req.responseText;
                } else {
                    alert("Problem: " + req.statusText);
                }
            }
        }

    </script>
</head>
<div id="help">
    <h2>
        <a href="<c:url value='helpMaterialForm.html?decorate=false'/>"
           title="<fmt:message key="help.materialForm"/>"
           onclick="Modalbox.show(this.href, {title: this.title, width: 600}); return false;">
            <fmt:message key="help"/>
        </a>
    </h2>
</div>


<div id="divDistinctive" style="position: absolute; left: 500px;" >
    <input id="addDistinctiveButton" type="button" value="<fmt:message key="button.add"/>" onclick="$(this).fade(); Effect.SlideDown('divDistinctiveForm'); return false;"/>
    <s:url id="dlu" action="ad" method="rdl">
        <s:param name="decorate" value="false" />
    </s:url>

    <s:div id="distinctives" theme="ajax" href="%{dlu}" loadingText="%{getText('ajax.loading')}..."/>
    <div id="divDistinctiveForm" style="width: 243px; display: none;" >

        <s:form action="saveAjaxDistinctive" method="get" validate="true">
            <s:hidden name="decorate" value="false"/>
            <s:hidden id="distinctiveId" name="distinctive.id" value="%{distinctive.id}"/>
            <s:hidden id="distinctiveIndex" name="distinctiveIndex"/>

                <s:doubleselect
                    name="distinctiveName"          doubleName="distinctiveValue"
                    list="distinctiveNames"         doubleList="distinctiveValues"
                    listKey="name"                    doubleListKey="name"
                    listValue="name"                doubleListValue="name"/>
            <li class="buttonBar bottom">
                <span id="distinctivesValues"></span>
                <s:submit cssClass="button" key="button.save" theme="ajax" targets="distinctives" notifyTopics="/save">
                </s:submit>

                <input id="cancelDistinctiveButton" type="button" value="<fmt:message key="button.cancel"/>" onclick="$('addDistinctiveButton').appear(); Effect.SlideUp('divDistinctiveForm'); return false;"/>

            </li>
        </s:form>

    </div>

</div>

<script type="text/javascript">
    Form.focusFirstElement($("materialForm"));
    document.getElementById('divDistinctive').style.top = document.getElementById('materialForm').offsetTop+"px";

</script>
